//
//  NSMutableDictionary+NSMutableDictionaryHelper.m
//  Activity2
//
//  Created by Calvin on 13-6-21.
//
//

#import "NSMutableDictionary+NSMutableDictionaryHelper.h"

@implementation NSMutableDictionary (NSMutableDictionaryHelper)


-(NSString *)stringForKey:(id)key{
    
	id s = [self objectForKey:key];
	if (s == [NSNull null] || ![s isKindOfClass:[NSString class]]){
        
		return nil;
	}
	return s;
}

-(NSNumber *)numberForKey:(id)key {
    
	id s = [self objectForKey:key];
	if (s == [NSNull null] || ![s isKindOfClass:[NSNumber class]]){
        
		return nil;
	}
	return s;
}

-(NSMutableDictionary *)dictionaryForKey:(id)key{
    
	id s = [self objectForKey:key];
	if (s == [NSNull null] || ![s isKindOfClass:[NSMutableDictionary class]]) {
        
		return nil;
	}
	return s;
}

-(NSMutableArray *)arrayForKey:(id)key{
    
	id s = [self objectForKey:key];
	if (s == [NSNull null] || ![s isKindOfClass:[NSMutableArray class]]) {
        
		return nil;
	}
    
	return s;
}

-(void)setHooy1Object:(id)anObject forKey:(id)aKey{
    
    if (!anObject) {
        
        [self setObject:[NSNull null] forKey:aKey];
    }else{
        
        [self setObject:anObject forKey:aKey];
    }
}

@end
